<template>
  <el-dialog title="查看工序" :visible.sync="dialogVisible" width="56%" append-to-body>
    <div class="mb20">中间品信息如下：</div>
    <table class="table1 owntable mb20 tableLayout" border="0" cellspacing="0" cellpadding="1" width="100%">
      <tr>
        <td width="150">工序编号</td>
        <td>{{ form.number }}</td>
        <td width="150">工序名称</td>
        <td>{{ form.name }}</td>
        <td width="150">是否为关键工序</td>
        <td>{{ form.isKey == 0 ? '否' : '是' }}</td>
      </tr>
    </table>

    <div class="mb20">操作人员：</div>
    <table class="table1 owntable mb20 tableLayout" border="0" cellspacing="0" cellpadding="1" width="100%">
      <tr>
        <td width="150">操作人员</td>
        <td>{{ form.operateUser.map(item=>item.name).join(',') }}</td>
      </tr>
    </table>
    <div class="mb20">使用的设备信息：</div>
    <table class="table1 owntable mb20 tableLayout" border="0" cellspacing="0" cellpadding="1" width="100%" v-for="(item, i) in form.deviceList" :key="i">
      <tr>
        <td width="150">设备编号</td>
        <td>{{ item.deviceName }}</td>
        <td width="150">设备名称</td>
        <td>{{ item.deviceModel }}</td>
        <td width="150">设备型号</td>
        <td>{{ item.deviceNumber }}</td>
      </tr>
    </table>
    <div slot="footer"><el-button size="small" type="primary" @click="close">去修改</el-button></div>
  </el-dialog>
</template>

<script>
import { getguifanList } from '@/api/myapi/tixiwenjian';
export default {
  data() {
    return {
      dialogVisible: false,
      deviceList: [],
      form: {
        operateUserId: [],
        operateUser: [],
        name: '',
        number: '',
        isDevice: 0, //是否使用设备:0-否，1-是		false
        isKey: 0, //是否关键工序:0-否，1-是		false
        isMiddle: 0, //是否使用中间品:0-否，1-是
        deviceList: [] // 设备
      }
    };
  },
  created() {},
  methods: {
    init(item) {
      console.log(item)
      if (item) this.form = item;
      this.dialogVisible = true;
    },
    close() {
      this.$emit('edit',this.form);
      this.dialogVisible = false;
      this.clearForm();
    },
    clearForm() {
      this.form={
        operateUserId: [],
        operateUser: [],
        name: '',
        number: '',
        isDevice: 0, //是否使用设备:0-否，1-是		false
        isKey: 0, //是否关键工序:0-否，1-是		false
        isMiddle: 0, //是否使用中间品:0-否，1-是
        deviceList: [] // 设备
      }
    },
  }
};
</script>

<style lang="scss" scoped="scoped">
.formbox {
  overflow: auto;
}

.formitem {
  margin-bottom: 60px;
}
.reviewList {
  background: #ffffff;
  border: 1px dashed #e4e8ed;
  opacity: 1;
  border-radius: 0px;
  padding: 20px 14px;
  position: relative;
  box-sizing: border-box;
  .delete {
    position: absolute;
    right: 10px;
    top: 10px;
  }
}
</style>
